local extension = Package:new("test2")
extension.extensionName = "aj_test"

local U = require "packages/utility/utility"

Fk:loadTranslationTable{
  ["test2"] = "测试·二",
}

local alan = General:new(extension, "test2__alan", "test_hui", 5)

Fk:loadTranslationTable{
  ["test2__alan"] = "阿兰",--名字
  ["#test2__alan"] = "以身作则",--称号
  ["designer:test2__alan"] = "zuozhe",--作者
  ["cv:test2__alan"] = "cv",--cv
  ["illustrator:test2__alan"] = "huashi",--画师

  ['~test2__alan'] = '不能保护大家了……',
}

local qingzhu = fk.CreateTriggerSkill{
  name = "test2__qingzhu",
  frequency = Skill.Compulsory,
  events ={fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
      return target == player and player:hasSkill(self.name) and player.phase == Player.Judge
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local judge = {
      who = player,
      reason = self.name,
      pattern = ".",
    }
    room:judge(judge)
    room:setPlayerMark(player,"test2__qingzhu-hs",judge.card.suit)
    room:setPlayerMark(player,"test2__qingzhu-lx",judge.card.type)
    room:setPlayerMark(player,"@test2__qingzhu",Fk:translate(judge.card:getSuitString(true))..Fk:translate(judge.card:getTypeString(true)))

    if table.find(room:getOtherPlayers(player),function (t)
        return t.hp > player.hp
      end) == nil then
      for _, t in ipairs(table.filter(room:getAlivePlayers(),function (t)
        return t.hp >= player.hp
      end)) do
        room:damage({
          from = player,
          to = t,
          damage = 1,
          damageType = fk.ThunderDamage,
          skillName = self.name,
        })
      end
    end
  end,
  refresh_events = {fk.EventPhaseStart},
  can_refresh = function (self, event, target, player, data)
    return target == player and player:hasSkill(self.name) and player.phase == Player.Start
  end,
  on_refresh = function (self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(player,"test2__qingzhu-hs",0)
    room:setPlayerMark(player,"test2__qingzhu-lx",0)
    room:setPlayerMark(player,"@test2__qingzhu",0)
  end,
  on_lose = function (self, player, is_death)
    local room = player.room
    room:setPlayerMark(player,"test2__qingzhu-hs",0)
    room:setPlayerMark(player,"test2__qingzhu-lx",0)
    room:setPlayerMark(player,"@test2__qingzhu",0)
  end,
}

local qingzhu_filter = fk.CreateFilterSkill{
  name = "#test2__qingzhu_filter",
  anim_type = "defensive",
  card_filter = function(self, card, player)
    return player:hasSkill(qingzhu) and (card.suit == player:getMark("test2__qingzhu-hs") or card.type == player:getMark("test2__qingzhu-lx"))
  end,
  view_as = function(self, card, player)
    local c = Fk:cloneCard("slash", card.suit, card.number)
    c.skillName = qingzhu.name
    return c
  end,
}

Fk:loadTranslationTable{
  ["test2__qingzhu"] = "倾注",
  [":test2__qingzhu"] = "锁定技，判定阶段开始时，1.你进行判定，然后你与此判定牌花色或类型相同的手牌均视为【杀】直到你的下个回合开始；2.若你的体力值为全场最大，你对体力值不小于你的角色各造成一点雷电伤害。",

  ["#test2__qingzhu_filter"] = "倾注",

  ["$test2__qingzhu1"] = "没什么能阻止我。",
  ["$test2__qingzhu2"] = "这点疼痛不足挂齿。",

  ["@test2__qingzhu"] = "倾注",
}

local jiegu = fk.CreateTriggerSkill{
  name = "test2__jiegu",
  events ={fk.Damage},
  frequency = Skill.Compulsory,
  can_trigger = function(self, event, target, player, data)
    local event_id = player.room.logic:getCurrentEvent().id
    return player:hasSkill(self) and player == data.from and
    player:getMark("@@test2__jiegu") ~= 0 and 
    player.phase ~= Player.NotActive and
    (#player.room.logic:getEventsOfScope(GameEvent.Damage, 1, function(e)
      local use = e.data[1]
      return use.from == player and e.id ~= event_id
    end, Player.HistoryTurn) == 0)
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(player:getLostHp(), self.name)
  end,
  refresh_events = {fk.RoundEnd},
  can_refresh = function (self, event, target, player, data)
    return player:hasSkill(self.name)
  end,
  on_refresh = function (self, event, target, player, data)
    if #player.room.logic:getEventsOfScope(GameEvent.UseCard, 998, function(e)
        local use = e.data[1]
        return use.from == player.id
      end, Player.HistoryRound) >= player.hp then
      player.room:setPlayerMark(player,"@@test2__jiegu",1)
    else
      player.room:setPlayerMark(player,"@@test2__jiegu",0)
    end
  end,
  on_acquire = function (self, player, is_start)
    if #player.room.logic:getEventsOfScope(GameEvent.UseCard, 998, function(e)
        local use = e.data[1]
        return use.from == player.id
      end, Player.HistoryRound) >= player.hp then
      player.room:setPlayerMark(player,"@@test2__jiegu",1)
    else
      player.room:setPlayerMark(player,"@@test2__jiegu",0)
    end
  end,
  on_lose = function (self, player, is_death)
    player.room:setPlayerMark(player,"@@test2__jiegu",0)
  end,
}

local jiegu_targetmod = fk.CreateTargetModSkill{
  name = "#test2__jiegu_targetmod",
  residue_func =function (self, player, skill, scope, card, to)
    if skill.trueName == "slash_skill" and player:getMark("@@test2__jiegu") > 0 then
      return player:getLostHp()
    end
  end,
}

Fk:loadTranslationTable{
  ["test2__jiegu"] = "解锢",
  [":test2__jiegu"] = "锁定技，若你于上轮结束前使用了不少于体力值张牌，则本轮你使用【杀】的次数+X且回合内首次造成伤害后摸X张牌（X为你已损失的体力值）。",
  
  ["#test2__jiegu_targetmod"] = "解锢",
  ["@@test2__jiegu"] = "解锢",

  ["$test2__jiegu1"] = "成全你们。",
  ["$test2__jiegu2"] = "都给我闭嘴！",

}

qingzhu:addRelatedSkill(qingzhu_filter)
alan:addSkill(qingzhu)
jiegu:addRelatedSkill(jiegu_targetmod)
alan:addSkill(jiegu)

local xier = General:new(extension, "test2__xier", "test_lie",  4, 4, General.Female)

Fk:loadTranslationTable{
  ["test2__xier"] = "希儿",--名字
  ["#test2__xier"] = "蝶立锋锷",--称号
  ["designer:test2__xier"] = "zuozhe",--作者
  ["cv:test2__xier"] = "cv",--cv
  ["illustrator:test2__xier"] = "huashi",--画师

  ['~test2__xier'] = '我…还能……',
}

local zaixian = fk.CreateTriggerSkill{
  name = "test2__zaixian",
  mute = true,
  events ={fk.TurnEnd},
  can_trigger = function(self, event, target, player, data)
      return target ~= player and player:hasSkill(self.name) and
      player.phase == Player.NotActive and not player:isKongcheng()
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local list = {}
    local ld = player:hasSkill("test2__luandie")
    player:broadcastSkillInvoke(self.name,math.random(1,2)+(ld and 1 or 0))
    room:notifySkillInvoked(player, self.name)
    player:showCards(player:getCardIds("h"))
    table.forEach(player:getCardIds("h"),function (element, index, array)
      local c = Fk:getCardById(element)
      table.insertIfNeed(list,c:getTypeString())
      table.insertIfNeed(list,c:getColorString())
    end)
    local n = math.min(#list,4)
    if n == 4 and ld then return end
    local num = {}
    for i = 1, 4 do
        table.insert(num, i)
    end
    if not room:askForSkillInvoke(player,self.name,nil,"#test2__zaixian") then
      num = table.reverse(num)
    end
    if ld then
      num = table.slice(num,n+1)
    else
      num = table.slice(num,1,n+1)
    end
    p(num)
    for _, v in ipairs(num) do
      if player.dead then break end
      if v == 1 then
        local cards = room:askForCard(player,1,1,true,self.name,false,nil,"#test2__zaixian-cz")
        room:recastCard(cards, player, self.name)
      elseif v == 2 then
        room:loseHp(player,1,self.name)
      elseif v == 3 and player:usedSkillTimes(self.name,Player.HistoryRound) <= player.hp then
          player:gainAnExtraTurn()
      elseif v == 4 then
        local name = "test2__luandie"
        if ld then name = "-"..name end
        room:handleAddLoseSkills(player,name)
      end
    end
  end,
}

Fk:loadTranslationTable{
  ["test2__zaixian"] = "再现",
  [":test2__zaixian"] = "其他角色回合结束时，你可展示手牌并依次执行正序或倒序的前X项（X为手牌颜色与类型数之和且最多为4）：1.重铸一张牌；2.失去一点体力；3.若本轮发动“再现”的次数不大于你的体力值，获得额外回合；4.获得“乱蝶”，若已有则失去之。",
  ["#test2__zaixian"] = "再现：是否以正序执行“再现”",
  ["#test2__zaixian-cz"] = "再现：重铸一张牌",

  ["$test2__zaixian1"] = "随蝴蝶一起消散吧。",
  ["$test2__zaixian2"] = "早点给你个痛快。",
  ["$test2__zaixian3"] = "纠缠不清。",
  ["$test2__zaixian4"] = "这就让你解脱。",

  ["@test2__zaixian"] = "再现",
}

local luandie = fk.CreateTriggerSkill{
  name = "test2__luandie",
  events ={fk.CardUsing},
  frequency = Skill.Compulsory,
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(self.name) and data.from == player.id and player.phase ~= Player.NotActive and
    data.card.color == Card.Black and data.card.trueName == "slash" then
      local event_id = player.room.logic:getCurrentEvent().id
      return (#player.room.logic:getEventsOfScope(GameEvent.UseCard, 1, function(e)
        local use = e.data[1]
        return use.card.color == Card.Black  and use.card.trueName == "slash" and
        use.from == player.id and e.id ~= event_id
      end, Player.HistoryTurn) == 0)
    end
  end,
  on_use = function(self, event, target, player, data)
    if not data.extraUse then
      player:addCardUseHistory(data.card.trueName, -1)
      data.extraUse = true
    end
  end,
}

--- 获取玩家手牌上限。
---@return integer
local getMaxCards = function(self,name)
  local baseValue = math.max(self.hp, 0)

  local status_skills = Fk:currentRoom().status_skills[MaxCardsSkill] or Util.DummyTable
  local max_fixed = nil
  for _, skill in ipairs(status_skills) do
    if skill.name ~= name then--排除
      local f = skill:getFixed(self)
      if f ~= nil then
        max_fixed = max_fixed and math.max(max_fixed, f) or f
      end      
    end
  end

  if max_fixed then baseValue = math.max(max_fixed, 0) end

  for _, skill in ipairs(status_skills) do
    local c = skill:getCorrect(self)
    baseValue = baseValue + (c or 0)
  end

  return math.max(baseValue, 0)
end

local luandie_maxcards = fk.CreateMaxCardsSkill{
  name = "#test2__luandie_maxcards",
  main_skill = luandie,
  fixed_func = function(self, player)
    if player:hasSkill(luandie) then
      return getMaxCards(player,self.name) * 2
    end
  end
}

Fk:loadTranslationTable{
  ["test2__luandie"] = "乱蝶",
  [":test2__luandie"] = "锁定技，你发动“再现”时改为执行未选择项，且你的手牌上限翻倍，回合内第一张黑【杀】不计入次数限制。",
  
  ["#test2__luandie_maxcards"] = "乱蝶",

  ["test2__luandie1"] = "",
  ["test2__luandie2"] = "",

}

xier:addSkill(zaixian)
luandie:addRelatedSkill(luandie_maxcards)
Fk:addSkill(luandie)
xier:addRelatedSkill(luandie)

local huke = General:new(extension, "test2__huke", "test_hui", 3, 3, General.Female)

Fk:loadTranslationTable{
  ["test2__huke"] = "虎克",--名字
  ["#test2__huke"] = "飞来焰火",--称号
  ["designer:test2__huke"] = "zuozhe",--作者
  ["cv:test2__huke"] = "cv",--cv
  ["illustrator:test2__huke"] = "huashi",--画师

  ['~test2__huke'] = '老爹…都没打过我……',
}

local yanxi = fk.CreateTriggerSkill{
  name = "test2__yanxi",
  frequency = Skill.Compulsory,
  events ={fk.CardUsing},
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(self.name) and data.card.color == Card.Red and
    data.card.trueName == "slash" then
      local event_id = player.room.logic:getCurrentEvent().id
      local t = table.filter(player.room:getAlivePlayers(),function (p)
        return p.hp ~= 1 and p.hp < #p:getCardIds("hej")
      end)
      self.cost_data = {t = t}
      return  
      (#player.room.logic:getEventsOfScope(GameEvent.UseCard, 1, function(e)
        local use = e.data[1]
        return use.card.color == Card.Red and use.card.trueName == "slash" and e.id ~= event_id
      end, Player.HistoryTurn) == 0)
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if #self.cost_data.t == 0  then
      player:drawCards(2, self.name)
    else
      for _, t in ipairs(self.cost_data.t) do
        room:damage({
          from = player,
          to = t,
          damage = 1,
          damageType = fk.FireDamage,
          skillName = self.name,
        })
      end
      --[[
      local t = room:askForChoosePlayers(player,table.map(room:getOtherPlayers(player),Util.IdMapper),1,1,"#test2__yanxi",self.name,false)
      if #t > 0 then
        player:drawCards(1, self.name)
        room:getPlayerById(t[1]):drawCards(1, self.name)
      end
      --]]
    end
  end,
}


Fk:loadTranslationTable{
  ["test2__yanxi"] = "焰嬉",
  --[":test2__yanxi"] = "锁定技，每回合首张红【杀】被使用后，若场上有体力值不为1且小于区域内牌数的角色，则你对这些角色各造成一点火焰伤害，然后你令你与一名其他角色各摸一张牌，否则你摸两张牌。",
  [":test2__yanxi"] = "锁定技，每回合首张红【杀】被使用后，若场上有体力值不为1且小于区域内牌数的角色，你对这些角色各造成1点火焰伤害，否则你摸两张牌。",
  
  ["#test2__yanxi"] = "焰嬉：令一名其他角色与你各摸一张牌",

  ["$test2__yanxi1"] = "我来了…嘿嘿…我又走咯~",
  ["$test2__yanxi2"] = "嘿嘿…没想到吧~",
  ["$test2__yanxi3"] = "哈！虎克来捣蛋！~",
}

huke:addSkill(yanxi)

local jingyuan = General:new(extension, "test2__jingyuan", "test_shi", 4)

Fk:loadTranslationTable{
  ["test2__jingyuan"] = "景元",--名字
  ["#test2__jingyuan"] = "天戈麾斥",--称号
  ["designer:test2__jingyuan"] = "zuozhe",--作者
  ["cv:test2__jingyuan"] = "cv",--cv
  ["illustrator:test2__jingyuan"] = "huashi",--画师

  ['~test2__jingyuan'] = '久疏战阵了…',
}

local choumou = fk.CreateTriggerSkill{
  name = "test2__choumou",
  events ={fk.EventPhaseEnd},
  can_trigger = function(self, event, target, player, data)
      if target == player and player:hasSkill(self.name) and
      player.phase == Player.Play then
        local n = {}
        player.room.logic:getEventsOfScope(GameEvent.MoveCards, 999, function(e)
          for _, move in ipairs(e.data) do
            if move.toArea == Card.DiscardPile then
              for _, info in ipairs(move.moveInfo) do
                table.insertIfNeed(n,Fk:getCardById(info.cardId).type)
              end
            end
          end
        end, Player.HistoryTurn)
        self.cost_data = {n = #n}
        return #n > 0
      end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:drawCards(self.cost_data.n,self.name)
    local n = player:getHandcardNum() - player.hp
    if n > 0 then
      local cards = room:askForCard(player,n,n,false,self.name,false,nil,"#test2__choumou-qi:::"..n)
      player:addToPile("test2__choumou",cards,true,"test2__choumou")
    end
    local suit = {}
    local max = 0
    for i = 1, 4, 1 do
      table.insert(suit,table.filter(player:getPile("test2__choumou"),function (id)
        return Fk:getCardById(id).suit == i
      end))
      if #suit[i] > max then max = #suit[i] end
    end
    local list = table.filter(suit,function (l)
      return #l == max
    end)
    if #list == 1 then
      room:moveCardTo(list[1], Card.DiscardPile, nil, fk.ReasonJustMove, "test2__choumou","test2__choumou",true,player.id)
    end
  end,
}

Fk:loadTranslationTable{
  ["test2__choumou"] = "绸缪",
  [":test2__choumou"] = "出牌阶段结束时，你可以摸本回合进入弃牌堆的牌的类型数张牌，然后将多于体力值的手牌置于武将牌上，最后弃置花色数唯一最多的“绸缪”牌。",

  ["#test2__choumou-qi"] = "绸缪：将%arg张牌置于武将牌上",

  ["$test2__choumou1"] = "该出奇兵了。",
  ["$test2__choumou2"] = "看来是棋逢对手。",

}

local shenkan = fk.CreateTriggerSkill{
  name = "test2__shenkan",
  mute = true,
  anim_type = "offensive",
  events ={fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(self.name) and
    player.phase == Player.Finish then
      local n = 0
      local suit,lb = {}, {}
      table.forEach(player:getPile("test2__choumou"),function (element, index, array)
        local c = Fk:getCardById(element)
        table.insertIfNeed(suit,c.suit)
        table.insertIfNeed(lb,c.type)
      end)
      if #suit == 4 then
        n = n + 1
      end
      if #lb == 3 then
        n = n + 1
      end
      self.cost_data = {n = n}
      return n > 0
    end
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local n = self.cost_data.n
    local ps = room:askForChoosePlayers(player,table.map(room:getAlivePlayers(),Util.IdMapper),
    1,n,"#test2__shenkan:::"..n,self.name)
    if #ps > 0 then
      self.cost_data = {n = n,p = ps}
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:broadcastSkillInvoke(self.name,math.random(1,2) + ((self.cost_data.n == 2) and 1 or 0 ))
    room:notifySkillInvoked(player, self.name,nil,self.cost_data.p)
    room:moveCardTo(player:getPile("test2__choumou"), Card.DiscardPile, nil, fk.ReasonJustMove, "test2__shenkan","test2__shenkan",true,player.id)
    for _, p in ipairs(room:getAlivePlayers()) do
      if table.contains(self.cost_data.p,p.id) and not p.dead then
        room:damage({
          from = player,
          to = p,
          damage = self.cost_data.n,
          damageType = fk.ThunderDamage,
          skillName = self.name,
        })
      end
    end
  end,
}

Fk:loadTranslationTable{
  ["test2__shenkan"] = "神勘",
  [":test2__shenkan"] = "结束阶段，若你的“绸缪”牌有：1.三种类型；2.四种花色，你可以弃置所有“绸缪”牌并对至多X名角色各造成X点雷电伤害（X为达成的项数）。",

  ["#test2__shenkan"] = "神勘：你可以弃置所有“绸缪”牌并对至多%arg名角色各造成%arg点雷电伤害",

  ["$test2__shenkan1"] = "兵戈，无情！",
  ["$test2__shenkan2"] = "雷霆，在此！",
  ["$test2__shenkan3"] = "煌煌威灵，遵吾敕命。",
  ["$test2__shenkan4"] = "斩无赦！",

}

jingyuan:addSkill(choumou)
jingyuan:addSkill(shenkan)

local suchang = General:new(extension, "test2__suchang", "test_lie", 4,4,General.Female)

Fk:loadTranslationTable{
  ["test2__suchang"] = "素裳",--名字
  ["#test2__suchang"] = "传古剑流",--称号
  ["designer:test2__suchang"] = "zuozhe",--作者
  ["cv:test2__suchang"] = "cv",--cv
  ["illustrator:test2__suchang"] = "huashi",--画师

  ['~test2__suchang'] = '这下…玩脱了…',
}

local youren = fk.CreateTriggerSkill{
  name = "test2__youren",
  events ={fk.Damage},
  can_trigger = function(self, event, target, player, data)
    local room = player.room
    local start_event = room.logic:getCurrentEvent():findParent(GameEvent.Turn, true)
    if target == player and player:hasSkill(self.name) and 
    player:getMark("@test2__youren-turn") == 0 and
    data.from == player and #data.to:getCardIds("e") == 0 and
    data.card and room:getCardArea(data.card) == Card.Processing then
      local e = room.logic:getEventsByRule(GameEvent.UseCard, 1, function(e)
          local use = e.data[1]
          return use.card.id == data.card.id and #use.tos == 1 and 
          TargetGroup:getRealTargets(use.tos)[1] == data.to.id
        end, start_event.id)
      if #e > 0 then
        self.cost_data = {id = e[1].id}
        if data.card:isVirtual() then
          return #data.card.subcards > 0
        end
        return true
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local card
    if data.card:isVirtual() then
      card = data.card.subcards
    else
      card = data.card
    end
    room:obtainCard(player, card, true, fk.ReasonJustMove)
    if (#room.logic:getEventsOfScope(GameEvent.UseCard, 1, function(e)
      local use = e.data[1]
      return e.id ~= self.cost_data.id and use.card.trueName == data.card.trueName and use.from == player.id 
      and table.contains(TargetGroup:getRealTargets(use.tos),data.to.id)
    end,  Player.HistoryTurn) > 0) then
      room:setPlayerMark(player,"@test2__youren-turn","#test2__youren-nil")
    end
  end,
}

Fk:loadTranslationTable{
  ["test2__youren"] = "游刃",
  [":test2__youren"] = "当你使用牌造成伤害后，若目标唯一且其装备区内没有牌，你可以回收造成伤害的牌，若你本回合对其使用过同名牌，本回合此技能失效。",

  ["@test2__youren-turn"] = "游刃",
  ["#test2__youren-nil"] = "失效",

  ["$test2__youren1"] = "马上就让你知道我的厉害。",
  ["$test2__youren2"] = "这便是云骑军的实力！",

}

local zhukou = fk.CreateTriggerSkill{
  name = "test2__zhukou",
  events ={fk.Damaged},
  can_trigger = function(self, event, target, player, data)
      return target == player and player:hasSkill(self.name)
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local ps = room:askForChoosePlayers(player,table.map(table.filter(room:getAlivePlayers(),function (p)
      return #p:getCardIds("hej") > 0
    end),Util.IdMapper),
    1,1,"#test2__zhukou",self.name)
    if #ps > 0 then
      self.cost_data = {p = ps[1]}
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local t = room:getPlayerById(self.cost_data.p)
    room:doIndicate(player.id, {t.id})
    local card = room:askForCardChosen(player, t, "hej", self.name,"#test2__zhukou-ask::"..t.id)
    room:throwCard(card,self.name,t,player)
    if Fk:getCardById(card).type == Card.TypeEquip then
      player:drawCards(1,self.name)
    end
  end,
}

Fk:loadTranslationTable{
  ["test2__zhukou"] = "逐寇",
  [":test2__zhukou"] = "当你受到伤害后，你可以弃置一名角色区域内一张牌，若为装备牌，你摸一张牌。",

  ["#test2__zhukou"] = "逐寇：你可以弃置一名角色区域内一张牌",
  ["#test2__zhukou-ask"] = "逐寇：弃置%dest一张牌",

  ["$test2__zhukou1"] = "小贼，哪里跑！",
  ["$test2__zhukou2"] = "这你躲不了啦！",

}

suchang:addSkill(youren)
suchang:addSkill(zhukou)

local yinlang = General:new(extension, "test2__yinlang", "test_xu", 3, 3, General.Female)

Fk:loadTranslationTable{
  ["test2__yinlang"] = "银狼",--名字
  ["#test2__yinlang"] = "零号协议",--称号
  ["designer:test2__yinlang"] = "zuozhe",--作者
  ["cv:test2__yinlang"] = "cv",--cv
  ["illustrator:test2__yinlang"] = "huashi",--画师

  ['~test2__yinlang'] = '我……',
}

local hairu = fk.CreateActiveSkill{
  name = "test2__hairu",
  prompt = "#test2__hairu",
  can_use = function(self, player)
    return not player:isNude()
  end,
  min_target_num = 1,
  min_card_num = 1,
  card_filter = function (self,to_select,selected,player)
    return #selected == 0 and Fk:getCardById(to_select).type ~= Card.TypeBasic
  end,
  target_filter = function (self, to_select, selected, selected_cards, card, extra_data, player)
    local t = Fk:currentRoom():getPlayerById(to_select)
    return #t:getPile("$test2__hairu-card") == 0
  end,
  on_use = function(self, room, effect)
    local player = room:getPlayerById(effect.from)
    local target = room:getPlayerById(effect.tos[1])
    target:addToPile("$test2__hairu-card", effect.cards[1], false, self.name, effect.from,{})
    room:addTableMark(player,"test2__hairu-round",target.id)
  end,
  on_lose = function (self, player, is_death)
    for _, p in ipairs(player.room:getOtherPlayers(player)) do
      if #p:getPile("$test2__hairu-card") > 0 then
        player.room:moveCardTo(p:getPile("$test2__hairu-card"), Card.DiscardPile, nil, fk.ReasonJustMove, "test2__hairu","test2__hairu",true,player.id)
      end
    end
  end,
}

local hairu_1 = fk.CreateTriggerSkill{
  name = "#test2__hairu_1",
  events ={fk.PreHpRecover},
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(self.name) then
      local hr = data.who:getPile("$test2__hairu-card")
      if #hr > 0 then
        local hrc = Fk:getCardById(hr[1])
         return hrc.color == Card.Red
      end
    end
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player.room:moveCardTo(data.who:getPile("$test2__hairu-card"), Card.DiscardPile, nil, fk.ReasonJustMove, "test2__hairu","test2__hairu",true,player.id)
    room:damage({
      from = player,
      to = data.who,
      damage = data.num,
      skillName = "test2__hairu",
    })
    return true
  end,
}

local hairu_2 = fk.CreateTriggerSkill{
  name = "#test2__hairu_2",
  events ={fk.DamageCaused},
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(self.name) and data.from then
      local hr = data.from:getPile("$test2__hairu-card")
      if #hr > 0 then
        local hrc = Fk:getCardById(hr[1])
         return hrc.color == Card.Black
      end
    end
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player.room:moveCardTo(data.from:getPile("$test2__hairu-card"), Card.DiscardPile, nil, fk.ReasonJustMove, "test2__hairu","test2__hairu",true,player.id)
    room:recover({
      who = data.to,
      num = data.damage,
      skillName = "test2__hairu",
    })
    return true
  end,
}

local hairu_3 = fk.CreateTriggerSkill{
  name = "#test2__hairu_3",
  refresh_events ={fk.RoundEnd},
  can_refresh = Util.TrueFunc,
  on_refresh = function (self, event, target, player, data)
    for _, p in ipairs(player.room:getOtherPlayers(player)) do
      if #p:getPile("$test2__hairu-card") > 0 then
        player.room:moveCardTo(p:getPile("$test2__hairu-card"), Card.DiscardPile, nil, fk.ReasonJustMove, "test2__hairu","test2__hairu",true,player.id)
      end
    end
  end,
}
local hairu_4 = fk.CreateVisibilitySkill{
  name = '#test2__hairu_4',
  frequency = Skill.Compulsory,
  card_visible = function(self, player, card)
    if player:getPileNameOfId(card.id) == "$test2__hairu-card" then
      return player:hasSkill(hairu)
    end
  end
}

Fk:loadTranslationTable{
  ["test2__hairu"] = "骇入",
  [":test2__hairu"] = "出牌阶段，你可将一张非基本牌暗置于没有“骇入”牌的角色的武将牌上直到本轮结束，若为红/黑色，其回复体力/造成伤害时弃置之并将之改为受到等量伤害/令原受伤者回复等量体力。",

  ["#test2__hairu_1"] = "骇入",
  ["#test2__hairu_2"] = "骇入",
  ["#test2__hairu_3"] = "骇入",
  ["#test2__hairu_4"] = "骇入",
  ["$test2__hairu-card"] = "骇入",
  ["#test2__hairu"] = "骇入：将一张非基本牌暗置于没有“骇入”牌的角色的武将牌上",

  ["$test2__hairu1"] = "这次能让我玩的开心点吗？",
  ["$test2__hairu2"] = "战斗体验该优化了。",
  ["$test2__hairu3"] = "来点刺激的！",
}

local fenghao = fk.CreateTriggerSkill{
    name = "test2__fenghao",
    events ={fk.Damaged},
    can_trigger = function(self, event, target, player, data)
      return target == player and player:hasSkill(self.name) and
        player:usedSkillTimes(self.name,Player.HistoryRound) == 0
    end,
    on_cost = function (self, event, target, player, data)
      local room = player.room
      local ps = room:askForChoosePlayers(player,table.map(table.filter(room:getAlivePlayers(),function (p)
        return table.contains(player:getTableMark("test2__hairu-round"),p.id)
      end),Util.IdMapper),
      1,1,"#test2__fenghao",self.name)
      if #ps > 0 then
        self.cost_data = {p = ps[1]}
        return true
      end
    end,
    on_use = function(self, event, target, player, data)
      local room = player.room
      local t = room:getPlayerById(self.cost_data.p)
      room:doIndicate(player.id, {t.id})
      t:turnOver()
    end,
  }

Fk:loadTranslationTable{
  ["test2__fenghao"] = "封号",
  [":test2__fenghao"] = "每轮限一次，当你受到伤害后，你可以令一名本轮成为过你“骇入”目标的角色翻面。",

  ["#test2__fenghao"] = "封号：你可以令一名角色翻面",

  ["$test2__fenghao1"] = "这么快就上钩了？",
  ["$test2__fenghao2"] = "百分百弱点击破。",
}
hairu:addRelatedSkill(hairu_1)
hairu:addRelatedSkill(hairu_2)
hairu:addRelatedSkill(hairu_3)
hairu:addRelatedSkill(hairu_4)
yinlang:addSkill(hairu)
yinlang:addSkill(fenghao)

local luocha = General:new(extension, "test2__luocha", "test_feng", 3 )

Fk:loadTranslationTable{
  ["test2__luocha"] = "罗刹",--名字
  ["#test2__luocha"] = "寻索世间",--称号
  ["designer:test2__luocha"] = "zuozhe",--作者
  ["cv:test2__luocha"] = "cv",--cv
  ["illustrator:test2__luocha"] = "huashi",--画师

  ['~test2__luocha'] = '没能…实现啊……',
}

local huaqi = fk.CreateTriggerSkill{
  name = "test2__huaqi",
  events ={fk.Damage},
  can_trigger = function(self, event, target, player, data)
    local event_id = player.room.logic:getCurrentEvent().id
    return player:hasSkill(self) and player:usedSkillTimes("test2__shengjie",Player.HistoryGame) > 0 and
    data.from and target == data.from and target:getMark("@@test2__huaqi") > 0 and 
    (#target.room.logic:getEventsOfScope(GameEvent.Damage, 1, function(e)
      local use = e.data[1]
      return use.from == target and e.id ~= event_id
    end, Player.HistoryRound) == 0)
  end,
  on_cost = function (self, event, target, player, data)
    local n = #table.filter(player.room:getAlivePlayers(),function (p)
      return p:getMark("@@test2__huaqi") > 0
    end)
    self.cost_data = {n = n}
    return n > 0 and target.room:askForSkillInvoke(target,self.name,nil,"#test2__huaqi-draw:::"..n)
  end,
  on_use = function(self, event, target, player, data)
    target:drawCards(self.cost_data.n, self.name)
  end,
}

local huaqi_1 = fk.CreateTriggerSkill{
  name = "#test2__huaqi_1",
  events ={fk.HpChanged},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and not table.contains(player:getTableMark("test2__huaqi"),"#test2__huaqi-hp") and
    player:usedSkillTimes("test2__shengjie",Player.HistoryGame) == 0 and target:getMark("test2__huaqi-phase") > 0 and
    target:isWounded()
  end,
  on_cost = function (self, event, target, player, data)
    target.room:setPlayerMark(target,"test2__huaqi-phase",0)
    return player.room:askForSkillInvoke(player,"test2__huaqi",nil,"#test2__huaqi::"..target.id)
  end,
  on_use = function(self, event, target, player, data)
    player.room:addTableMark(player,"test2__huaqi","#test2__huaqi-hp")
    player.room:setPlayerMark(target,"@@test2__huaqi",1)
    player.room:recover({
      who = target,
      num = 1,
      recoverBy = player,
      skillName = "test2__huaqi",
    })
  end,
  refresh_events = {fk.BeforeHpChanged},
  can_refresh = function (self, event, target, player, data)
    return
    --player:hasSkill(self) and  not table.contains(player:getTableMark("test2__huaqi"),"#test2__huaqi-hp") and
    ((target.hp + data.num) == 2) and (data.num < 0) 
    and target == player
  end,
  on_refresh = function (self, event, target, player, data)
    target.room:setPlayerMark(target,"test2__huaqi-phase",1)
  end,
}

local huaqi_2 = fk.CreateTriggerSkill{
  name = "#test2__huaqi_2",
  events ={fk.EnterDying},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and not table.contains(player:getTableMark("test2__huaqi"),"#test2__huaqi-bs") and
    player:usedSkillTimes("test2__shengjie",Player.HistoryGame) == 0 and data.who == target.id and target:isWounded()
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askForSkillInvoke(player,"test2__huaqi",nil,"#test2__huaqi::"..target.id)
  end,
  on_use = function(self, event, target, player, data)
    player.room:addTableMark(player,"test2__huaqi","#test2__huaqi-bs")
    player.room:setPlayerMark(target,"@@test2__huaqi",1)
    player.room:recover({
      who = target,
      num = 1,
      recoverBy = player,
      skillName = "test2__huaqi",
    })
  end,
}

local huaqi_3 = fk.CreateTriggerSkill{
  name = "#test2__huaqi_3",
  events = {fk.AfterCardsMove},
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(self) and not table.contains(player:getTableMark("test2__huaqi"),"#test2__huaqi-kc") and
    player:usedSkillTimes("test2__shengjie",Player.HistoryGame) == 0 then
      local kc = false
      for _, move in ipairs(data) do
        if move.from then
          local t = player.room:getPlayerById(move.from)
          --[[
          if #t:getCardIds("hej") > 0 or not t:isWounded() then return end
          for _, info in ipairs(move.moveInfo) do
            if info.fromArea == Card.PlayerHand or info.fromArea == Card.PlayerEquip or info.fromArea == Card.PlayerJudge then
              self.cost_data = {t = t}
              kc = true
            end
          end
          --]]
          if t.dead or not t:isKongcheng() or not t:isWounded() then return false end
          for _, info in ipairs(move.moveInfo) do
            if info.fromArea == Card.PlayerHand then
              self.cost_data = {t = t}
              kc = true
              break
            end
          end
        end
      end
      return kc
    end
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askForSkillInvoke(player,"test2__huaqi",nil,"#test2__huaqi::".. self.cost_data.t.id)
  end,
  on_use = function(self, event, target, player, data)
    player.room:addTableMark(player,"test2__huaqi","#test2__huaqi-kc")
    player.room:setPlayerMark(self.cost_data.t,"@@test2__huaqi",1)
    player.room:recover({
      who = self.cost_data.t,
      num = 1,
      recoverBy = player,
      skillName = "test2__huaqi",
    })
  end,
}


Fk:loadTranslationTable{
  ["test2__huaqi"] = "花祈",
  --[":test2__huaqi"] = "每项限一次，一名角色达成以下条件后，你可以令其回复一点体力：1.体力值减少至二后；2.濒死时；3.区域内没有牌后。",
  [":test2__huaqi"] = "每项限一次，你可以令一名角色于以下时机回复1点体力：1.体力值减少至2后；2.进入濒死时；3.没有手牌后。",

  ["#test2__huaqi_1"] = "花祈",
  ["#test2__huaqi_2"] = "花祈",
  ["#test2__huaqi_3"] = "花祈",
  
  ["@@test2__huaqi"] = "花祈",
  ["#test2__huaqi"] = "花祈：你可以令%dest回复1点体力",
  ["#test2__huaqi-draw"] = "花祈：你可以摸%arg张牌",

  ["$test2__huaqi1"] = "白花盛放。",
  ["$test2__huaqi2"] = "领受天赐。",
}

local shengjie = fk.CreateTriggerSkill{
    name = "test2__shengjie",
    frequency = Skill.Wake,
    events ={fk.AfterSkillEffect},
    can_trigger = function(self, event, target, player, data)
      return target == player and player:hasSkill(self.name) and player:usedSkillTimes(self.name,Player.HistoryGame) == 0
    end,
    can_wake = function (self, event, target, player, data)
      return #player:getTableMark("test2__huaqi") == 3 and player:hasSkill("test2__huaqi",true,true)
    end,
    on_use = function(self, event, target, player, data)

    end,
  }

Fk:loadTranslationTable{
  ["test2__shengjie"] = "生界",
  [":test2__shengjie"] = "觉醒技，当“花祈”触发所有项后，你修改技能“花祈”为：你与成为过“花祈”目标的角色于每轮首次造成伤害后可以摸X张牌（X为成为过“花祈”目标的存活角色数）。",

  ["$test2__shengjie1"] = "凡夺取的，必将偿还。",
  ["$test2__shengjie2"] = "清算的时刻到了。",
}
huaqi:addRelatedSkill(huaqi_1)
huaqi:addRelatedSkill(huaqi_2)
huaqi:addRelatedSkill(huaqi_3)
luocha:addSkill(huaqi)
luocha:addSkill(shengjie)

local yukong = General:new(extension, "test2__yukong", "test_xie", 3, 3, General.Female)

Fk:loadTranslationTable{
  ["test2__yukong"] = "驭空",--名字
  ["#test2__yukong"] = "天舶司舵",--称号
  ["designer:test2__yukong"] = "zuozhe",--作者
  ["cv:test2__yukong"] = "cv",--cv
  ["illustrator:test2__yukong"] = "huashi",--画师

  ['~test2__yukong'] = '我……无颜面对……',
}

local yinyu = fk.CreateTriggerSkill{
  name = "test2__yinyu",
  frequency = Skill.Limited,
  events ={fk.Damage},
  can_trigger = function(self, event, target, player, data)
      return target == player and player:hasSkill(self.name) and 
      player:usedSkillTimes(self.name,Player.HistoryGame) == 0 and 
      data.from and data.from == player and
      #data.to:getPile("test2__mingxian") > 0 and
      data.card and data.card.trueName == "slash"
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askForSkillInvoke(player, self.name, nil, "#test2__yinyu")
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    for _, t in ipairs(room:getAlivePlayers()) do
      for _, c in ipairs(t:getPile("test2__mingxian")) do
        if data.to.dead then break end
        room:askForUseRealCard(player,{c},self.name,nil,{exclusive_targets = {data.to.id} ,expand_pile = {c}},false)
      end
    end
  end,
}

Fk:loadTranslationTable{
  ["test2__yinyu"] = "饮羽",
  --[":test2__yinyu"] = "<b>限定技</b>，当你使用【杀】对有“<b>鸣弦</b>”牌的角色造成伤害后，你可以将场上所有“<b>鸣弦</b>”牌依次对其使用，之后将“<b>鸣弦</b>”中的“目标武将牌上”改为“牌堆底”。",
  [":test2__yinyu"] = "<b>限定技</b>，当你使用【杀】对有“<b>鸣弦</b>”牌的角色造成伤害后，你可以将场上所有“<b>鸣弦</b>”牌依次对其使用。",

  ["#test2__yinyu"] = "饮羽：你可以对其使用所有“<b>鸣弦</b>”牌",

  ["$test2__yinyu1"] = "风起，云鸢就位。",
  ["$test2__yinyu2"] = "只此，一箭！",
}

local mingxian = fk.CreateTriggerSkill{
    name = "test2__mingxian",
    events ={fk.TargetSpecified},
    can_trigger = function(self, event, target, player, data)
      return player:hasSkill(self) and data.card.trueName == "slash" and
        #AimGroup:getAllTargets(data.tos) == 1 and
        --#player.room:getPlayerById(TargetGroup:getRealTargets(data.tos)[1]):getPile("test2__mingxian") == 0 and
        player:usedSkillTimes(self.name) == 0
    end,
    on_cost = function(self, event, target, player, data)
      if table.find(player:getCardIds("h"),function (id)
        return Fk:getCardById(id).trueName == "slash"
      end) then
        local room = player.room
        local cards
        local t = room:getPlayerById(TargetGroup:getRealTargets(data.tos)[1])
        if #t:getPile("test2__mingxian") == 0 then
          --[[
          cards = room:askForCard(player,1,1,false,self.name,true,"slash",
          "#test2__mingxian:::"..((player:usedSkillTimes(yinyu.name,Player.HistoryGame) == 0) and "#test2__mingxian-mubiao" or "Bottom"))
          self.cost_data = cards
          --]]
          cards = room:askForCard(player,1,1,false,self.name,true,"slash","#test2__mingxian-put::"..t.id)
          self.cost_data = {cards = cards}
        else
          cards = room:askForDiscard(player,1,1,false,self.name,true,"slash","#test2__mingxian-dis::"..t.id)
          self.cost_data = {cards = false}
        end
        return #cards > 0
      end
    end,
    on_use = function(self, event, target, player, data)
      local room = player.room
      --[[
      local cards = self.cost_data
      if #cards > 0 then
        local t = room:getPlayerById(TargetGroup:getRealTargets(data.tos)[1])
        
        if player:usedSkillTimes(yinyu.name,Player.HistoryGame) == 0 then
          t:addToPile("test2__mingxian", cards, true, self.name,player.id)
        else
          room:moveCards({
            ids = cards,
            from = player.id,
            toArea = Card.DrawPile,
            moveReason = fk.ReasonPut,
            skillName = self.name,
            drawPilePosition = -1,
          })
        end
        
        data.disresponsive = true
        room:drawCards(player,2,self.name)
      end
      --]]
      if self.cost_data.cards then
        local t = room:getPlayerById(TargetGroup:getRealTargets(data.tos)[1])
          t:addToPile("test2__mingxian", self.cost_data.cards, true, self.name,player.id)
      end
      data.disresponsive = true
      player:drawCards(2,self.name)
    end,
  }

Fk:loadTranslationTable{
  ["test2__mingxian"] = "鸣弦",
  --[":test2__mingxian"] = "每回合限一次，当一名角色使用【杀】指定武将牌上没有“<b>鸣弦</b>”牌的角色为唯一目标后，你可以将一张【杀】置于目标武将牌上并令之不可响应，然后你摸两张牌。",
  [":test2__mingxian"] = "每回合限一次，当一名角色使用【杀】指定唯一目标后，你可将一张【杀】置于目标武将牌上，令之不可被响应，然后你摸两张牌。若目标武将牌上已有“鸣弦”牌，则改为弃置一张【杀】。",
  
  --["#test2__mingxian"] = "鸣弦：你可以将一张【杀】置于%arg",
  --["#test2__mingxian-mubiao"] = "目标武将牌上",
  ["#test2__mingxian-put"] = "鸣弦：你可以将一张【杀】置于%dest武将牌上，令%dest无法响应",
  ["#test2__mingxian-dis"] = "鸣弦：你可以弃置一张【杀】，令%dest无法响应",

  ["$test2__mingxian1"] = "气冲云霄！",
  ["$test2__mingxian2"] = "势如疾风！",
}

yukong:addSkill(mingxian)
yukong:addSkill(yinyu)

local luka = General:new(extension, "test2__luka", "test_xu", 4)

Fk:loadTranslationTable{
  ["test2__luka"] = "卢卡",--名字
  ["#test2__luka"] = "冠军拳手",--称号
  ["designer:test2__luka"] = "zuozhe",--作者
  ["cv:test2__luka"] = "cv",--cv
  ["illustrator:test2__luka"] = "huashi",--画师

  ['~test2__luka'] = '不能…这么狼狈……',
}

local juexin = fk.CreateTriggerSkill{
  name = "test2__juexin",
  events ={fk.CardUsing},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self.name) and
    player:getMark("@test2__juexin") < 4 and table.find(player:getCardIds("he"),function (id)
      return Fk:getCardById(id).trueName == data.card.trueName
    end) ~= nil
  end,
  on_cost = function (self, event, target, player, data)
    local cards = player.room:askForCard(player,1,999,true,self.name,true,data.card.trueName,"#test2__juexin")
    self.cost_data = {cards = cards}
    return #cards > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:recastCard(self.cost_data.cards, player, self.name)
    room:addPlayerMark(player,"@test2__juexin",#self.cost_data.cards)
  end,
}

Fk:loadTranslationTable{
  ["test2__juexin"] = "决心",
  [":test2__juexin"] = "当你使用牌时，若你的“斗志”不大于3，你可以重铸任意张同名牌并获得等量“斗志”。",
  
  ["@test2__juexin"] = "斗志",
  ["#test2__juexin"] = "决心：你可以重铸任意张同名牌",

  ["$test2__juexin1"] = "哼，现在才开始。",
  ["$test2__juexin2"] = "值得我认真起来的对手！",
}

local zhisheng = fk.CreateTriggerSkill{
  name = "test2__zhisheng",
  events ={fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self.name) and
    player.phase == Player.Start and player:getMark("@test2__juexin") > 0 
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local n = player:getMark("@test2__juexin")
    player:turnOver()
    player:drawCards(n,self.name)
    room:setPlayerMark(player,"@test2__juexin",0)
    room:setPlayerMark(player,"@test2__zhisheng-turn",n)
  end,
}

local zhisheng_jb = fk.CreateTriggerSkill{
  name = "#test2__zhisheng_jb",
  events ={fk.CardUsing},
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(self.name) and data.from == player.id and
    data.card.type == Card.TypeBasic and player:getMark("@test2__zhisheng-turn") > 0 then
      local event_id = player.room.logic:getCurrentEvent().id
      return (#player.room.logic:getEventsOfScope(GameEvent.UseCard, 1, function(e)
        local use = e.data[1]
        return use.card.type == Card.TypeBasic and
        use.from == player.id and e.id ~= event_id
      end, Player.HistoryTurn) == 0)
    end
  end,
  on_use = function(self, event, target, player, data)
    data.additionalEffect = (data.additionalEffect or 0) + player:getMark("@test2__zhisheng-turn") - 1
  end,
}

Fk:loadTranslationTable{
  ["test2__zhisheng"] = "制胜",
  [":test2__zhisheng"] = "准备阶段，你可以移去所有“斗志”并翻面，然后摸X张牌（X为移去的“斗志”数），且你可令本回合使用的首张基本牌结算X次。",

  ["@test2__zhisheng-turn"] = "制胜",
  ["#test2__zhisheng_jb"] = "制胜",

  ["$test2__zhisheng1"] = "见识下火花四溅吧！",
  ["$test2__zhisheng2"] = "欢呼声在哪？",

}

luka:addSkill(juexin)
zhisheng:addRelatedSkill(zhisheng_jb)
luka:addSkill(zhisheng)

local danhengyinyue = General:new(extension, "test2__danhengyinyue", "test_hui", 3)

Fk:loadTranslationTable{
  ["test2__danhengyinyue"] = "丹恒·饮月",--名字
  ["#test2__danhengyinyue"] = "濯世垂虹",--称号
  ["designer:test2__danhengyinyue"] = "zuozhe",--作者
  ["cv:test2__danhengyinyue"] = "cv",--cv
  ["illustrator:test2__danhengyinyue"] = "huashi",--画师

  ['~test2__danhengyinyue'] = '不该是…现在…',
}

local longzhuo = fk.CreateTriggerSkill{
  name = "test2__longzhuo",
  events ={fk.CardUsing},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self.name) and
    player:usedSkillTimes(self.name) == 0 and data.card.trueName == "slash" and
    not player:isNude()
  end,
  on_cost = function (self, event, target, player, data)
    local cards = player.room:askForCard(player,1,999,true,self.name,true,nil,"#test2__longzhuo")
    self.cost_data = {cards = cards}
    return #cards > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cards = self.cost_data.cards
    room:throwCard(cards,self.name,player,player)
    local n = {}
    table.forEach(cards,function (element, index, array)
      table.insertIfNeed(n,Fk:getCardById(element).type)
    end)
    if #n > 1 then
      player:drawCards(#n - 1,self.name)
    end
    for i = 1, #n, 1 do
      if i == 1 then
        local targets = table.filter(player.room:getOtherPlayers(player), function(p)
          return player:distanceTo(p) == 1
        end)
        data.disresponsiveList = data.disresponsiveList or {}
        for _, p in ipairs(targets) do
          table.insertIfNeed(data.disresponsiveList, p.id)
        end
      elseif i == 2 then
        local tos = room:getUseExtraTargets(data,false)
        if #tos > 0 then
          local num = math.min(#tos,2)
          tos = room:askForChoosePlayers(player,tos,1,num,"#test2__longzhuo-ask:::"..num,self.name)
          if #tos > 0 then
            TargetGroup:pushTargets(data.tos,tos)
          end
        end
      elseif i == 3 then
        data.additionalDamage = (data.additionalDamage or 0) + 1
        break
      end
    end
  end,
}

Fk:loadTranslationTable{
  ["test2__longzhuo"] = "龙濯",
  [":test2__longzhuo"] = "每回合限一次，当你使用【杀】时，你可以弃置任意张牌并摸X-1张牌，然后依次执行X项（X为弃置牌类型数）：1.距离1以内角色不可响应；2.可多指定至多两名角色为目标；3.伤害+1。",
  
  ["#test2__longzhuo"] = "龙濯：你可以弃置任意张牌",
  ["#test2__longzhuo-ask"] = "龙濯：你可以额外指定至多%arg名角色",

  ["$test2__longzhuo1"] = "霄龙现影，破！",
  ["$test2__longzhuo2"] = "神蛟腾云，起！ ",
}

local fuchen = fk.CreateTriggerSkill{
  name = "test2__fuchen",
  anim_type = "drawcard",
  events ={fk.CardUseFinished},
  can_trigger = function(self, event, target, player, data)
    local n = player.room:getPlayerById(data.from).hp - player.hp
    self.cost_data = {n = n}
    return player:hasSkill(self.name) and
    player:usedSkillTimes(self.name) == 0 and n > 0 and
    table.contains(TargetGroup:getRealTargets(data.tos),player.id)
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(self.cost_data.n,self.name)
  end,
}

Fk:loadTranslationTable{
  ["test2__fuchen"] = "伏辰",
  [":test2__fuchen"] = "每回合限一次，体力值大于你的角色使用牌后，若你为目标之一，你可以摸与其体力差值张牌。",

  ["$test2__fuchen1"] = "潜鳞，已现。",
  ["$test2__fuchen2"] = "我能感受到这股躁动……",
}

danhengyinyue:addSkill(longzhuo)
danhengyinyue:addSkill(fuchen)

return extension